// XMLProfile.h
// By Emilio Guijarro Cameros

#pragma once

#include <windows.h>
#include <msxml.h>
#include <shlobj.h>
#include <comutil.h>

class CXMLProfile
{
	class CXMLProfileException 
	{
		
	public:
		TCHAR sMessage[255];
		
		CXMLProfileException(LPTSTR sMessage)
		{
			lstrcpy(CXMLProfileException::sMessage, sMessage);
		}
	};

	IXMLDOMDocumentPtr pXMLDoc;
	IXMLDOMNodePtr blazeEntry(LPCTSTR lpszSection, LPCTSTR lpszEntry);
	IXMLDOMNodePtr blazeSection(LPCTSTR lpszEntry);

	_bstr_t sFileName;

public:
	CXMLProfile(LPCTSTR lpszProfileName);
		
	bool writeProfileInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, int nValue);
	bool writeProfileString(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCTSTR lpszData);
	
	int getProfileInt(LPCTSTR lpszSection, LPCTSTR lpszEntry, int nDefault);
	LPSTR getProfileString(LPCTSTR lpszSection, LPCTSTR lpszEntry, LPCSTR lpszDefault, LPSTR lpBuffer, UINT nBufferSize);

	bool saveProfile();
	bool loadProfile();	

	~CXMLProfile();
};



